﻿using System;
using System.ComponentModel.DataAnnotations;
using Castle.ActiveRecord;

namespace CQIE.OVS.Model
{
    /// <summary>
    /// 选手信息
    /// </summary>
    [ActiveRecord("CampaignerInfo")]
    public class Campaigner:EntityBase
    {
        [Property]
        [Display(Name = "姓名")]
        public string Name { get; set; }


        [Property]
        [Display(Name = "简介")]
        public string Info { get; set; }


        [Property]
        public string img { get; set; }


        [BelongsTo(Type = typeof(Activity),Column = "ActivityId",Lazy = FetchWhen.OnInvoke)]
        public Activity Activity { get; set; }


        [Property]
        [Display(Name = "性别")]
        public int Sex { get; set; }


        [Property]
        public DateTime Birthday { get; set; }

        [Display(Name = "年龄")]
        public int Age { get; set; }

        [Property]
        public int IsAlive { get; set; }

        [Property]
        public int Num { get; set; }

        public DateTime GetBirthday(int age)
        {
            int birday = DateTime.Now.Year - age;
            DateTime bd = new DateTime(birday,1,1,0,0,0);
            return bd;
        }

        public int GetAge(DateTime bd)
        {
            int age = DateTime.Now.Year - bd.Year;
            return age;
        }
    }
}
